package com.unicom.mec.device.controller;


import com.unicom.mec.device.common.ResultBean;
import com.unicom.mec.device.service.EdgeEndpointService;
import com.unicom.mec.device.vo.EdgeEndpointVo;
import com.unicom.mec.device.vo.EdgeNodeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 边缘端点控制层
 *
 * @author 刘亮武
 * @date 2020年06月17日
 */
@Api(value = "/edge-endpoint", tags = "边缘端点管理")
@RestController
@RequestMapping("/edge-endpoint")
public class EdgeEndpointController {

    @Autowired
    private EdgeEndpointService edgeEndpointService;

    @ApiOperation(value = "查询边缘端点信息", httpMethod = "GET")
    @GetMapping("/")
    @ResponseBody
    ResultBean<List<EdgeEndpointVo>> findEdgeEndpoints(@ApiParam(value = "租户主键") @RequestParam(value = "tenantId", required = false) Long tenantId,
                                                       @ApiParam(value = "节点主键") @RequestParam(value = "edgeNodeId", required = false) Long edgeNodeId) {
        List<EdgeEndpointVo> edgeEndpointVos = edgeEndpointService.findEdgeEndpoints(tenantId, edgeNodeId);
        ResultBean<List<EdgeEndpointVo>> result = new ResultBean<>();
        result.setData(edgeEndpointVos);
        return result;
    }
}
